package com.ruoyi.web.xxj.enums;

import com.ruoyi.common.utils.StringUtils;

public enum PayStatus {
    NOPAID("未支付", "0"),
    PAIDED("已支付", "1"),
    REFUND_TO_AUDIT("退款待审核", "2"),
    REFUND_PASS_AUDIT("退款通过审核", "3"),
    REFUND_REJECT("拒绝退款", "4"),
    REFUNDED("已退款", "5"),
    REFUND_FAIL("退款失败", "6"),
    CANCEL("取消订单", "7");
    //TIMEOUT("订单已超时", "8");

    private String name;
    private String value;

    public static String getNameByValue(String value) {
        for (PayStatus payStatus : values()) {
            if (StringUtils.equals(payStatus.getValue(), value)) {
                return payStatus.getName();
            }
        }
        throw new IllegalArgumentException("Invalid value!");
    }

    private PayStatus(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public String getValue() {
        return value;
    }
}
